Reference

https://bookdown.org/yihui/rmarkdown/

Inline formatting

Inline text will be italic if surrounded by underscores or asterisks, e.g., text or text. Bold text is produced using a pair of double asterisks (text). A pair of tildes (~) turn text to a subscript (e.g., H3PO4 renders H3PO4). A pair of carets (^) produce a superscript (e.g., Cu2+ renders Cu2+).

To mark text as inline code, use a pair of backticks, e.g., code.

Hyperlinks are created using the syntax text, e.g., RStudio. The syntax for images is similar: just add an exclamation mark, e.g., ![alt text or image title](path/to/image). Footnotes are put inside the square brackets after a caret 1, e.g., 2.

Section headers can be written after a number of pound signs, e.g.,

First-level header

Second-level header

Third-level header

If you do not want a certain heading to be numbered, you can add {-} or {.unnumbered} after the heading, e.g.,

Preface

Unordered list items start with *, -, or +, and you can nest one list within another list by indenting the sub-list, e.g.,

Ordered list items start with numbers (you can also nest lists within lists), e.g.,

  1. the first item
  2. the second item
  3. the third item
    • one unordered item
    • one unordered item

Blockquotes are written after >, e.g.,

“I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him.”

— Mark Twain

In R, the character # indicates a comment. And does “-” mean a bullet point below?

The result of 5 - 3 is 2. Different flavors of Markdown may produce different results if there are no blank lines.

R code chunks and inline R code

You can insert an R code chunk either using the RStudio toolbar (the Insert button) or the keyboard shortcut Ctrl + Alt + I (Cmd + Option + I on macOS).

There are a lot of things you can do in a code chunk: you can produce text output, tables, or graphics. You have fine control over all these output via chunk options, which can be provided inside the curly braces (between ```{r and }). For example, you can choose hide text output via the chunk option results = ‘hide’, or set the figure height to 4 inches via fig.height = 4. Chunk options are separated by commas, e.g.,

Figure 1: this is a caption for the figure

Figure 1: this is a caption for the figure

Why not doing a interactive graph? :)

Figure 2: a cool interactive graph!

Now we want to go further, and do an interactive MAP!!! Let’s use the fishing effort dataset:


  1. This is a footnote.